package com.wz.boot.dao.weather;

import com.wz.boot.function.weather.Weather;
import com.wz.boot.pojo.weather.WeatherSubscription;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface WeatherSubscriptionDao {
    @Select("select * from WeatherSubscription")
    List<WeatherSubscription> selectAllWeatherSubscription();

    @Insert("insert into WeatherSubscription (uid,weathersettinguid,qqaccount,placename,timenode)values" +
            "(#{uid},#{weatherSettingUid},#{qqAccount},#{placeName},#{timeNode})")
    Boolean addWeatherSubscription(@Param("uid") String uid,
                                   @Param("weatherSettingUid")String weatherSettingUid,
                                   @Param("qqAccount")String qqAccount,
                                   @Param("placeName")String placeName,
                                   @Param("timeNode")String timeNode);

    @Delete("delete from weathersubscription where qqaccount = #{qqAccount} and placename = #{placeName} and timeNode = #{timeNode}")
    Boolean deleteWeatherSubscription(@Param("qqAccount")String qqAccount,
                                      @Param("placeName")String placeName,
                                      @Param("timeNode")String timeNode);


    @Select("select * from weathersubscription where qqaccount = #{qqAccount}")
    List<WeatherSubscription> selectWeatherSubscriptionByQqAccount(@Param("qqAccount")String qqAccount);

    @Delete("delete from weathersubscription where qqaccount = #{qqAccount}")
    Boolean deleteWeatherSubscriptionByQqAccount(@Param("qqAccount")String qqAccount);

    @Select("select * from weathersubscription where timenode = '6'")
    List<WeatherSubscription> selectWeatherSubscriptionByTimeNode6();

    @Select("select * from weathersubscription where timenode = '12'")
    List<WeatherSubscription> selectWeatherSubscriptionByTimeNode12();

    @Select("select * from weathersubscription where timenode = '18'")
    List<WeatherSubscription> selectWeatherSubscriptionByTimeNode18();
}
